﻿@{
    ViewBag.Title = "EGP | Graph";
}

@using (Html.BeginForm())
{
    <div>
        <div id="PanelArea">
            <div id="Panel">
                <div style="color: rgb(0, 132, 180);">Currency</div>
                <select name="Currency" id="Currency"> 
                    <option>EUR-USD</option>
                    <option>GBP-USD</option>
                    <option>USD-CHF</option>
                    <option>USD-SEK</option>
                    <option>USD-DKK</option>
                    <option>USD-NOK</option>
                    <option>USD-CZK</option>
                    <option>USD-SKK</option>
                    <option>USD-PLN</option>
                    <option>USD-HUF</option>
                    <option>USD-RUB</option>
                    <option>USD-TRY</option>
                    <option>USD-ILS</option>
                    <option>USD-KES</option>
                    <option>USD-ZAR</option>
                    <option>USD-MAD</option>
                    <option>USD-JPY</option>
                    <option>AUD-USD</option>
                    <option>USD-CAD</option>
                    <option>EUR-GBP</option>
                    <option>EUR-JPY</option>
                    <option>AUD-JPY</option>
                </select><br />
                <div style="color: rgb(0, 132, 180); ">Period</div>
                <select name="Period" id="Period"> 
                    <option value="Day">Day</option>
                    <option value="Week">Week</option>
                    <option value="Month">Month</option>
                    <option value="Year">Year</option>
                </select><br />
                <div class="PeriodDate">
                    <div style="float: left;">
                        <div style="color: rgb(0, 132, 180); ">Day</div>
                        <select name="Day" id="Day"> 
                            @for (int i = 1; i <= 31; i++)
                            {
                                if (i < 10)
                                {
                                    string Temp = "0" + @i.ToString();
                                    <option>@Temp</option>
                                }
                                else
                                {
                                    <option>@i.ToString()</option>
                                }
                            }
                        </select>
                    </div>
                    <div style="float: left;">
                        <div style="color: rgb(0, 132, 180); ">Month</div>
                        <select name="Month" id="Month">
                            @for (int i = 1; i <= 12; i++)
                            {
                                if (i < 10)
                                {
                                    string Temp = "0" + @i.ToString();
                                    <option>@Temp</option>
                                }
                                else
                                {
                                    <option>@i.ToString()</option>
                                }
                            }
                        </select>
                    </div>
                    <div style="float: left;">
                        <div style="color: rgb(0, 132, 180); ">Year</div>
                        <select name="Year" id="Year">
                            @for (int i = 2010; i <= 2015; i++)
                            {
                                <option>@i.ToString()</option>
                            }
                        </select>
                    </div>
                    <div class="Clear"></div>
                </div>
            </div>
        </div>
        <div id="GraphDiv">
        </div>
        <div class="Clear"></div>
    </div><br /><br /><br /><br />
}



<script language="javascript" type="text/javascript">
    function Update() {
        $("#GraphDiv").load('@Url.Action("PaintAll")',
        {
            Period: $("#Period").val(),
            Date: $("#Day").val() + "-" + $("#Month").val() + "-" + $("#Year").val(), 
            Currency: $("#Currency").val()
        },
        function () {
            $("#GraphDiv").html("<img src='../../GraphImg/Pic_Temp.png' id='GraphImg' alt='Graph' />")
        });
    }

    $(document).ready()
    {
        Update();
    }
    $("#Period").change(function () {
        Update();
    });
    $("#Currency").change(function () {
        Update();
    });
    $("#Day").change(function () {
        Update();
    });
    $("#Month").change(function () {
        Update();
    });
    $("#Year").change(function () {
        Update();
    });
</script>